Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothDevice.kt 78274c792318331b11ab64cd28e58e829875b8c2 (78274c79) Text, 1.92 KB

T8b949e/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

Tff7b72package T7ee787com.geeksville.mesh.repository.bluetooth

Tff7b72import T7ee787android.bluetooth.BluetoothDevice
Tff7b72import T7ee787android.content.BroadcastReceiver
Tff7b72import T7ee787android.content.Context
Tff7b72import T7ee787android.content.Intent
Tff7b72import T7ee787android.content.IntentFilter
Tff7b72import T7ee787androidx.annotation.RequiresPermission
Tff7b72import T7ee787com.geeksville.mesh.util.registerReceiverCompat
Tff7b72import T7ee787kotlinx.coroutines.channels.awaitClose
Tff7b72import T7ee787kotlinx.coroutines.flow.Flow
Tff7b72import T7ee787kotlinx.coroutines.flow.callbackFlow

Tf0883e@RequiresPermissionTb4b4b4(Ta5d6ff"Ta5d6ffandroid.permission.BLUETOOTH_CONNECTTa5d6ff"Tb4b4b4)
Tff7b72internal Tff7b72fun Te6edf3BluetoothDeviceTb4b4b4.Td2a8ffcreateBondTb4b4b4(Te6edf3contextTb4b4b4: Te6edf3ContextTb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Tffa657IntTff7b72> Tff7b72= Te6edf3callbackFlow Tb4b4b4{
Tff7b72val Te6edf3receiver Tff7b72= Tff7b72object Tb4b4b4: T56d364BroadcastReceiverTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72override Tff7b72fun Td2a8ffonReceiveTb4b4b4(Te6edf3contextTb4b4b4: Te6edf3ContextTb4b4b4, Te6edf3intentTb4b4b4: Te6edf3IntentTb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3state Tff7b72= Te6edf3intentTb4b4b4.Te6edf3getIntExtraTb4b4b4(Te6edf3BluetoothDeviceTb4b4b4.Te6edf3EXTRA_BOND_STATETb4b4b4, Tff7b72-T79c0ff1Tb4b4b4)
Te6edf3trySendTb4b4b4(Te6edf3stateTb4b4b4)

T8b949e// we stay registered until bonding completes (either with BONDED or NONE)
Tff7b72if Tb4b4b4(Te6edf3state Tff7b72!Tff7b72= Te6edf3BluetoothDeviceTb4b4b4.Te6edf3BOND_BONDINGTb4b4b4) Tb4b4b4{
Te6edf3closeTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tff7b72val Te6edf3filter Tff7b72= Te6edf3IntentFilterTb4b4b4(Te6edf3BluetoothDeviceTb4b4b4.Te6edf3ACTION_BOND_STATE_CHANGEDTb4b4b4)
Te6edf3contextTb4b4b4.Te6edf3registerReceiverCompatTb4b4b4(Te6edf3receiverTb4b4b4, Te6edf3filterTb4b4b4)
Te6edf3createBondTb4b4b4(Tb4b4b4)

Te6edf3awaitClose Tb4b4b4{ Te6edf3contextTb4b4b4.Te6edf3unregisterReceiverTb4b4b4(Te6edf3receiverTb4b4b4) Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s